<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <h2>{{count}}</h2>
  <!--<button v-on:click="count++">+</button>-->
  <!--<button v-on:click="count--">-</button>-->

  <!--<button v-on:click="increment">+</button>-->
  <!--<button v-on:click="decrement">-</button>-->

  <!--语法糖写法-->
  <button @click="increment">+</button>
  <button @click="decrement">-</button>
</div>

<script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el: '#app',
    data: {
      count: 0
    },
    methods: {
      increment() {
        this.count++;
      },
      decrement() {
        this.count--;
      }
    }
  });
</script>
</body>
</html>